package com.zwz.crm.conf;

import com.zwz.crm.handler.LoginInterceptor;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * Created by zhaowuz on 2020/1/12.
 */
@Configuration
public class MyWebMvcConfigurer implements WebMvcConfigurer {

    @Value("${bsi.isLogin}")
    public String isLogin;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new LoginInterceptor(isLogin))
                .addPathPatterns("/**")
                .excludePathPatterns("/login")
                .excludePathPatterns("/loginOut")
                .excludePathPatterns("/**/js/**")
                .excludePathPatterns("/**/*.ico")
                .excludePathPatterns("/**/css/**");
    }
}
